package com.example.axon.config;

import com.example.axon.AccountAggregate;
import org.axonframework.eventsourcing.EventSourcingRepository;
import org.axonframework.eventsourcing.eventstore.EventStore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AxonRepositoryConfig {


    @Bean("accountAggregateRepository")
    public EventSourcingRepository<AccountAggregate> accountAggregateRepository(EventStore eventStore) {
        return EventSourcingRepository.builder(AccountAggregate.class)
                .eventStore(eventStore)
                .build();
    }

}